package com.jx.gocomtask.webservice.entity;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jx.gocomtask.webservice.DTO.CallMeStatus;
import com.jx.gocomtask.webservice.DTO.CycleRun;
import com.jx.gocomtask.webservice.DTO.ScheduleStatus;
import com.jx.gocomtask.webservice.DTO.TaskScope;
import com.jx.gocomtask.webservice.DTO.TaskStatus;
import com.jx.gocomtask.webservice.DTO.WorkStatus;
import com.jx.gocomtask.webservice.entity.base.ExtTaskMessageBase;
import com.jx.gocomtask.webservice.entity.listener.ExtTaskMessageListener;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;


/**
 * The persistent class for the ext_task_message database table.
 * 
 */
@Entity
@Table(name="ext_task_message")
@EntityListeners(ExtTaskMessageListener.class)
public class ExtTaskMessage extends ExtTaskMessageBase{

	/**
	 * @Description:
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	private String uuid;

	@Column(name="gocom_c_msg_id")
	private String gocomCMsgId;

	@Column(name="gocom_g_msg_id")
	private String gocomGMsgId;

	private String content;

	@Column(name="from_device")
	private String from;


	@Column(name="from_user")
	private String fromUser;

	@Column(name="from_user_name")
	private String fromUserTrueName;


	@Enumerated(EnumType.ORDINAL)
	private TaskScope scope;

	@Column(name="gocom_group")
	private String group;

	@Enumerated(EnumType.ORDINAL)
//	@Column(name = "status")
	private TaskStatus status;

	@Column(name="p_id")
   private Long pId=0L;
	
	@Column(name="from_wechat_user")
	private String fromWechatUser;
	
	@Column(name="from_wechat_user_name")
	private String fromWechatUserName;
 
	@Enumerated(EnumType.ORDINAL)
   @Column(name = "exec_plan")
	private ScheduleStatus execPlan=ScheduleStatus.LIGTH;
	
	//is_remind
	@Enumerated(EnumType.ORDINAL)
	 @Column(name = "is_remind")
	private CallMeStatus isRemind=CallMeStatus.NO;
	
//	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

	@Column(name = "deadline")
	private Date deadline;
	
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "is_repeat")
	private CycleRun isRepeat=CycleRun.NO;
	
	@Enumerated(EnumType.ORDINAL)
	 @Column(name = "work_mode")
	private WorkStatus workMode=WorkStatus.NO;
	
	private String label;
	
	@Column(name = "message_type")
	private String messageType;
	
	//完成/拒绝时间
	@Column(name = "finish_time")
	private Date finishTime=null;
	
	//关闭时间
	@Column(name = "close_time")
	private Date closeTime=null;
	
	@Column(name="update_time", insertable = false, updatable = false)
	private Date updateTime;

	@Column(name="create_time", insertable = false, updatable = false)
	private Date createTime;

	private Integer source = 0;

	@Column(name = "context_flag")
	public Integer contextFlag = 0;

	@OneToMany(mappedBy="extTaskMessage", cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
	private List<ExtTaskUser> extTaskUser = new LinkedList<>();

	@OneToOne(cascade = {CascadeType.ALL})
	@JoinColumn(name = "id")
	private ExtTaskExtension extTaskExtension;
	
	@OneToOne(mappedBy="extTaskMessage", cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
	private ExtRemindPlan ExtRemindPlan;

	public ExtTaskMessage() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getFrom() {
		return this.from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	@Override
	public String getFromUserTrueName() {
		return fromUserTrueName;
	}

	@Override
	public void setFromUserTrueName(String fromUserTrueName) {
		this.fromUserTrueName = fromUserTrueName;
	}

	public String getGroup() {
		return this.group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	public TaskStatus getStatus() {
		return this.status;
	}

	public void setStatus(TaskStatus stats) {
		this.status = stats;
	}

	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public List<ExtTaskUser> getExtTaskUser() {
		return extTaskUser;
	}

	public void setExtTaskUser(List<ExtTaskUser> extTaskUser) {
		this.extTaskUser = extTaskUser;
	}

	public String getGocomCMsgId() {
		return gocomCMsgId;
	}

	public void setGocomCMsgId(String gocomCMsgId) {
		this.gocomCMsgId = gocomCMsgId;
	}

	public String getGocomGMsgId() {
		return gocomGMsgId;
	}

	public void setGocomGMsgId(String gocomGMsgId) {
		this.gocomGMsgId = gocomGMsgId;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getFromUser() {
		return fromUser;
	}

	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}

	public TaskScope getScope() {
		return scope;
	}

	public void setScope(TaskScope scope) {
		this.scope = scope;
	}

	public ExtTaskExtension getExtTaskExtension() {
		return extTaskExtension;
	}

	public void setExtTaskExtension(ExtTaskExtension extTaskExtension) {
		this.extTaskExtension = extTaskExtension;
	}

	public String getFromWechatUser() {
		return fromWechatUser;
	}

	public void setFromWechatUser(String fromWechatUser) {
		this.fromWechatUser = fromWechatUser;
	}

	public String getFromWechatUserName() {
		return fromWechatUserName;
	}

	public void setFromWechatUserName(String fromWechatUserName) {
		this.fromWechatUserName = fromWechatUserName;
	}

	public ScheduleStatus getExecPlan() {
		return execPlan;
	}

	public void setExecPlan(ScheduleStatus execPlan) {
		this.execPlan = execPlan;
	}

	public CallMeStatus getIsRemind() {
		return isRemind;
	}

	public void setIsRemind(CallMeStatus isRemind) {
		this.isRemind = isRemind;
	}

	public Date getDeadline() {
		return deadline;
	}

	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}

	public WorkStatus getWorkMode() {
		return workMode;
	}

	public void setWorkMode(WorkStatus workMode) {
		this.workMode = workMode;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getMessageType() {
		return messageType;
	}

	public void setMessageType(String messageType) {
		this.messageType = messageType;
	}

	public CycleRun getIsRepeat() {
		return isRepeat;
	}

	public void setIsRepeat(CycleRun isRepeat) {
		this.isRepeat = isRepeat;
	}

	public Integer getSource() {
		return source;
	}

	public void setSource(Integer source) {
		this.source = source;
	}

	public Integer getContextFlag() {
		return contextFlag;
	}

	public void setContextFlag(Integer contextFlag) {
		this.contextFlag = contextFlag;
	}

	public Long getpId() {
		return pId;
	}

	public void setpId(Long pId) {
		this.pId = pId;
	}

	public ExtRemindPlan getExtRemindPlan() {
		return ExtRemindPlan;
	}

	public void setExtRemindPlan(ExtRemindPlan extRemindPlan) {
		ExtRemindPlan = extRemindPlan;
	}

	public Date getFinishTime() {
		return finishTime;
	}

	public void setFinishTime(Date finishTime) {
		this.finishTime = finishTime;
	}

	public Date getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(Date closeTime) {
		this.closeTime = closeTime;
	}
}